package huxibianjie.com.lbscandroid.widget;

/**
 * 防止快速点击
 */
public class NoDoubleClickUtils {
    private final static int SPACE_TIME = 500;
    private static long lastClickTime = 0;

    public static void initLastClickTime() {
        lastClickTime = 0;
    }

    /**
     * 是双击
     *
     * @return
     */
    public synchronized static boolean isDoubleClick() {
        long currentTime = System.currentTimeMillis();
        boolean isClick;
        if (currentTime - lastClickTime > SPACE_TIME) {
            isClick = false;
        } else {
            isClick = true;
        }
        lastClickTime = currentTime;
        return isClick;
    }
}